﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wwtfly.BBS.BackModels.Models.Right;
using Wwtfly.BBS.BackDAL.Right;
using Wwtfly.LoggerUtility;
using Wwtfly.BBS.Framework.Execption;
namespace Wwtfly.BBS.BackBLL.Right
{
  public partial  class UAUserOfRoleBLL
    {
        #region 属性
        //错误编码 (默认为不知原因的异常,使用者需要自己修改为相应的正确编码)
        private const string GET_INFO_ERROR_CODE = "9999";
        private const string GET_LIST_ERROR_CODE = "9999";
        private const string ADD_ERROR_CODE = "9999";
        private const string UPDATE_ERROR_CODE = "9999";
        private const string DELETE_ERROR_CODE = "9999";
        private const string NEWLIST_ERROR_CODE = "9999";
        #endregion
   
        /// <summary>
        /// 根据UserID获取指定的UAUserOfRole
        /// </summary>
        /// <param name="UserID">UAUserOfRole主键</param>
        /// <returns></returns>
        public static UAUserOfRoleModel GetInfo(Int32 UserID)
        {
            try
            {
                return UAUserOfRoleDAL.GetInfo(UserID);
            }
            catch (Exception ex)
            {
                LoggerManage.Error(new LogMessageParams()
              {
                  ModuleID = "UAUserOfRoleBLL",
                  FuncCode = " GetInfo(Int32 UserID)",
                  Level = AppErrorLevel.EROR,
                  ErrCode = GET_INFO_ERROR_CODE,
                  Excep = ex,
                  logMessage = "根据Id获取指定的UAUserOfRoleModel.出错",
                  ProgramName = "Wwtilfy.BBS"
              });
                throw new WwtflyBusinessException("E_" + NEWLIST_ERROR_CODE, ex);
            }
        }

        /// <summary>
        /// 添加新的UAUserOfRole
        /// </summary>
        /// <param name="uAUserOfRole">UAUserOfRole实体</param>
        /// <returns></returns>
        public static int Add(UAUserOfRoleModel uAUserOfRole)
        {
            try
            {
                return UAUserOfRoleDAL.Add(uAUserOfRole);
            }
            catch (Exception ex)
            {
                  LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "UAUserOfRoleBLL",
                    FuncCode = "Add(UAUserOfRoleModel uAUserOfRole)",
                    Level = AppErrorLevel.EROR,
                    ErrCode = ADD_ERROR_CODE,
                    Excep = ex,
                    logMessage = "添加角色中间表UAUserOfRoleDAL.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                throw new WwtflyBusinessException("E_" + ADD_ERROR_CODE, ex);
            }
        }

        /// <summary>
        /// 修改WKF_WorkItemOfKit
        /// </summary>
        /// <param name="uAUserOfRole">UAUserOfRole实体</param>
        /// <returns></returns>
        public static bool Update(UAUserOfRoleModel uAUserOfRole)
        {
            try
            {
                return UAUserOfRoleDAL.Update(uAUserOfRole);
            }
            catch (Exception ex)
            {
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "UAUserOfRoleBLL",
                    FuncCode = "Update(UAUserOfRoleModel uAUserOfRole)",
                    Level = AppErrorLevel.EROR,
                    ErrCode = ADD_ERROR_CODE,
                    Excep = ex,
                    logMessage = "更新角色中间表UAUserOfRoleDAL.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                throw new WwtflyBusinessException("E_" + UPDATE_ERROR_CODE, ex);
            }
        }

        /// <summary>
        /// 删除WKF_WorkItemOfKit 
        /// </summary>
        /// <param name="UserID">UAUserOfRole主键</param>
        /// <returns></returns>
        public static bool Delete(Int32 UserID)
        {
            try
            {
                return UAUserOfRoleDAL.Delete(UserID);
            }
            catch (Exception ex)
            {
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "UAUserOfRoleBLL",
                    FuncCode = "Delete(Int32 UserID)",
                    Level = AppErrorLevel.EROR,
                    ErrCode = ADD_ERROR_CODE,
                    Excep = ex,
                    logMessage = "删除角色中间表UAUserOfRoleDAL.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                throw new WwtflyBusinessException("E_" + DELETE_ERROR_CODE, ex);
            }
        }
    }
}
